package org.qqcui.designpattern.patterns.command;

/**
 * 打开电灯的命令实现类
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022/5/6 11:12
 **/
public class LightOnCommand implements Command {

    private LightReceiver lightReceiver;

    public LightOnCommand(LightReceiver lightReceiver) {
        this.lightReceiver = lightReceiver;
    }

    @Override
    public void execute() {
        // 调用打开电灯操作
        lightReceiver.on();
    }

    @Override
    public void undo() {
        // 调用撤销操作
        lightReceiver.off();
    }
}
